Where the ground is in one column of the room: the y of the first solid pixel at or below y in the column at x, or -1 if there is none all the way down. It follows slopes pixel by pixel, so it is the height of a ramp at that x.
tile_ground_y(x, y) -> int| Name | Type |
|---|---|
x | real |
y | real |
int
Where the ground is in one column of the room. It looks down from y in the column at x and gives back the y of the first solid pixel it finds, or -1 if there is none all the way down. It follows slopes pixel by pixel, so on a ramp it is the height of the ramp at that x.
x and y are a place in the room, counted from the room's top-left corner. y is where the search starts. Ask from above the ground, or from inside it, and the answer is the first solid pixel at or below y.
The answer is a whole number of pixels, counted from the top of the room, the same way an instance's y is.
It is the same ground tile_solid means: a solid square or a low cover square, and where the square has a slope shape, only the pixels of the shape that are solid. A square that blocks nothing is skipped, and so is the open part of a slope.
The top of a One-way platform counts as ground too, but only its top: a pixel of a One-way square with another One-way pixel right above it is skipped, so asking from inside a platform finds the ground under it, not the platform you are in.
y in that column, all the way to the bottom of the room.x is outside the room.The cost is a look at one square for every 8 pixels it has to go down, then a look at the pixels of the first square that blocks.
var floor_y = tile_ground_y(x, y);
if (floor_y >= 0) {
y = floor_y - 8;
}Puts the walker 8 pixels above the ground under it, even when that ground is a ramp. (The 8 is half the height of a 16 pixel tall walker.)
Ground is what tile_solid calls solid: a solid or low cover square, where its shape is solid. Squares that block nothing are skipped. A column outside the room, a room with no collision tile layer and a column with nothing solid below y all give -1. The answer is a whole pixel. The cost is a look at one square for each 8 pixels it has to go down, then a look at pixels inside the first square that blocks.